<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    
        /*
        闭包：一个使用了外部函数的参数或者变量的函数
        */

        function a() {
            var x = 10;
            function b() {
                 x ++;
                 var y = 20;
                 y++;
                 alert(x);
                 alert(y);
            }
            
            return b;
        }
        var c = a();
        c();
        c();
        c();
        c();



    </script>
</body>
</html>